﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HenIT.Text
{
    /// <summary>
    /// Helper class to define DataTable formatting in a HTMLWriter
    /// </summary>
    public class DataTableFormatSettings
    {
        /// <summary>
        /// Initialize DataTableFormatSettings
        /// </summary>
        public DataTableFormatSettings()
        {
            RowClassNames = new string[] { };
            LeftAlignHeadings = false;
            ColumnHeaderClass = "";
            LinkIDField = "";
            LinkPageUrl = "";
            LinkDisplayField = "";
            LinkIDParameter = "";
            DisplayLinkIDField = false;
        }
        /// <summary>
        /// Define an array of CSS class names for use in alternating colors in rows
        /// </summary>
        public string[] RowClassNames { get; set; }
        /// <summary>
        /// Should column headers be left aligned
        /// </summary>
        public bool LeftAlignHeadings { get; set; }
        /// <summary>
        /// Define custom CSS class for column header cells
        /// </summary>
        public string ColumnHeaderClass { get; set; }
        private string linkIDField = "";
        /// <summary>
        /// Define the Id field of the DataTable when using embedded 'edit' links to another page
        /// </summary>
        public string LinkIDField
        {
            get { return linkIDField; }
            set
            {
                if (LinkIDParameter == "")
                    LinkIDParameter = value;
                linkIDField = value;
            }
        }
        /// <summary>
        /// Define the 'edit' page url when using embedded 'edit' links
        /// </summary>
        public string LinkPageUrl { get; set; }
        /// <summary>
        /// Define the displayed field name when using embedded 'edit' links
        /// </summary>
        public string LinkDisplayField { get; set; }
        /// <summary>
        /// Define the parameter name when using embedded 'edit' links
        /// </summary>
        public string LinkIDParameter { get; set; }
        /// <summary>
        /// Enable linking to 'edit' page
        /// </summary>
        public bool DisplayLinkIDField { get; set; }
    }
}
